﻿Imports HotelLibrary

Public Class insertHotel
    Inherits System.Web.UI.Page
    Dim objDb As New DBConnect
    Dim ds As New DataSet
    Dim hotelPxy As New hotelService.HotelService

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub

    Protected Sub btnInsert_Click(sender As Object, e As EventArgs) Handles btnInsert.Click
        Dim m_hotel As New hotelService.Hotel_t

        m_Hotel.City = txtCity.Text
        m_Hotel.HotelName = txtHotelName.Text
        m_Hotel.RoomAvailability = txtRoomAvail.Text
        m_Hotel.State = DropDownListState.SelectedItem.ToString
        m_Hotel.Stars = CInt(ddlStar.SelectedItem.ToString)
        m_Hotel.ZipCode = txtZip.Text
        Session.Add("Hotel", txtHotelName.Text)
        If (chkAC.Checked) Then
            m_Hotel.AirConditioner = "True"
        Else
            m_Hotel.AirConditioner = "False"
        End If

        If (chkSmoking.Checked) Then
            m_hotel.Smoking = "True"
        Else
            m_hotel.Smoking = "False"
        End If

        If (chkSpa.Checked) Then
            m_hotel.Spa = "True"
        Else
            m_hotel.Spa = "False"
        End If

        If (chkSwimmingPool.Checked) Then
            m_hotel.Swimming = "True"
        Else
            m_hotel.Swimming = "False"
        End If

        If (chkInternet.Checked) Then
            m_hotel.Wifi = "True"
        Else
            m_hotel.Wifi = "False"
        End If

        If (chkRestaurant.Checked) Then
            m_hotel.Restaurant = "True"
        Else
            m_hotel.Restaurant = "False"
        End If

        If (chkPetAllowed.Checked) Then
            m_hotel.Pet = "True"
        Else
            m_hotel.Pet = "False"
        End If

        If (chkParking.Checked) Then
            m_hotel.Parking = "True"
        Else
            m_hotel.Parking = "False"
        End If

        If (chkBreakfast.Checked) Then
            m_hotel.FreeBreakfast = "True"
        Else
            m_hotel.FreeBreakfast = "False"
        End If

        If (chkBusiness.Checked) Then
            m_hotel.Business = "True"
        Else
            m_hotel.Business = "False"
        End If

        hotelPxy.insertHotel(m_hotel)
        ds = objDb.getDataSet("Select HotelID from Hotel_t where HotelName = '" & m_hotel.HotelName & "'")
        m_hotel.HotelID = CInt(ds.Tables(0).Rows(0).Item(0).ToString)
        hotelPxy.insertAmenities(m_Hotel)

    End Sub
End Class